﻿package GameStates
{

	import flash.display.MovieClip;
	import flash.events.Event;
	import src.Bullets;
	
	import src.Player_ship;
	/**
	 * ...
	 * @author Ivan Lucas Neves
	 */
	public class Level_01 extends MovieClip
	{
		var ship :Player_ship;
		var bullet :Bullets;
		
		public function Level_01() 
		{
			
			addEventListener(Event.ADDED_TO_STAGE, AddStage, false, 0, true);
		}
		
		private function AddStage(e:Event):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, AddStage);
			
			iniciarJogo();
		}
		
		private function iniciarJogo():void 
		{
			ship = new Player_ship();
			ship.x = ship.width;
			ship.y = stage.stageHeight / 2;
			addChildAt(ship, 0);
		}
		
		function Update():void
		{
			ship.Update();
			
			if (bullet != null)
			{
				
					bullet.Update();
				
			}
		}
		
	}

}